Skip to content

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Feb 5, 2021

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm a possible followup

# https://github.com/numpy/numpy/issues/12550
# timedelta64 will incorrectly cast to int
converted = [converted] * mask.sum()
values[mask] = converted
if not is_list_like(converted):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pattern is pretty common, maybe a helper function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah one more PR coming up that uses this pattern yet again; i think its going to end up in array_algos.putmask,

# expressions.where will cast np.timedelta64 to int
result = self.values.copy()
result[~cond] = [other] * (~cond).sum()
dtype, _ = infer_dtype_from(other, pandas_dtype=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g here as well

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Feb 7, 2021
@jreback jreback added this to the 1.3 milestone Feb 7, 2021
@jreback jreback merged commit 4861964 into pandas-dev:master Feb 7, 2021
@jbrockmendel jbrockmendel deleted the bug-index-putmask branch February 7, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants